package mapper;

import model.Course;
import model.Teacher;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface TeacherMapper {
    @Select("select * from teacher")
    @Results({
            @Result(column = "id",property = "id",javaType = Integer.class),
            @Result(column = "id",property = "courses",javaType = List.class,
            many = @Many(select="mapper.TeacherCourseMapper.selectByTeacherId"))
    })
    public List<Teacher> findAll();
    @Select("select * from teacher where id=#{id}")
    public Teacher selectByPrimaryKey(int id);
}
